<template>
  <div class="header">
    <div class="header-left">
      <span class="iconfont back-icon">&#xe61e;</span>
    </div>
    <div class="header-input">
      <span class="iconfont">&#xe680;</span>
      输入城市/景点/默认主题
    </div>
    <router-link to="/city">
      <!-- <div class="header-right" @click="toCity"></div> -->
      <!-- methods: {
            toCity() {
              this.$router.push('/city')
            }
          } -->
      <div class="header-right">
        {{this.city}}
        <span class="iconfont arrow-icon">&#xe600;</span>
      </div>
    </router-link>
  </div>
</template>

<script>
// 输入部分说的86间上12，再见下12,就是input说的height高度，再有margin-left 为.2rem；
//不设font-size默认按初始化包块的16px 这里是reset中的默认100% 50px
import { mapState } from 'vuex'
export default {
  name: 'homeHeader',
  computed: {
    ...mapState(['city'])
    //  把vuex中的公用数据city 映射到computed中的city中  也可以是{}，里面是 {你命名的： 映射的数据}
  }
}
</script>

<style scoped>
.header {
  background: #00bcd4;
  display: flex;
  line-height: 0.86rem;
  font-size: 0.26rem;
  color: #fff;
}
.header-left {
  width: 0.64rem;
  float: left;
}
.back-icon {
  text-align: center;
  font-size: 0.4rem;
}
.header-input {
  color: #ccc;
  flex: 1;
  background: #fff;
  border-radius: 0.1rem;
  height: 0.64rem;
  line-height: 0.64rem;
  margin-top: 0.12rem;
  margin-left: -0.2rem;
  padding-left: 0.2rem;
}
.header-right {
  min-width: 1.14rem;
  padding: 0.02rem;
  float: right;
  text-align: center;
  color: #fff;
}
.arrow-icon {
  font-size: 0.2rem;
}
</style>